;^Z80^ TITLE FILE: DDP_INTER:TOS HEWLETT-PACKARD: DDP_INTERFACE (c) Coleco 1983 Confidential ;NAME ^Rev 01 - DTT^ De_DDP_INTERFACE MACRO ;Header Rev. 5 .GOTO Ede_DDP_INTERFACE Project: TAPE, C101 ****************************** * * * DDP_INTERFACE DTT * * * ****************************** Rev History Rev. Date Name Change 1 9/13/83 DTT CHANGED TO ALLOW ERROR RETIRES 0 7/5/83 DTT Initial Pseudo Code Function: REQUEST READS AND WRITES AS DEFINED IN OCB. REQUESTS ABORT_TAPE. TEST STATUS OF TAPE REQUEST. Ede_DDP_INTERFACE MEND Pseudo_code_DDP_INTERFACE MACRO ;Pseudocode macro area BEGIN: STORE D_OVERLAY_NUMBER HL := POINTER TO OCB := D_OVERLAY_NUMBER*5 + OVERLAY_TABLE_POINTER MOVE OCB TO D_CSA IF WRITE THEN SEND WRITE_COMMAND ELSE SEND READ_COMMAND ENDIF END .GOTO Ep_DDP_INTERFACE Ep_DDP_INTERFACE MEND ;Subroutines called ; EXT ;Subroutines defined GLOBAL TEST_TAPE GLOBAL ABORT_TAPE GLOBAL LOAD_OVERLAY GLOBAL WRITE_OVERLAY GLOBAL CALC_OCB_ADDR GLOBAL WRITE_BLOCKS GLOBAL LOAD_BLOCKS GLOBAL BLOCK_IO ; GLOBAL ;Operating system calls ; EXT ;Inputs/Outputs passed in registers ; A = OVERLAY NUMBER 1 thru N ; A <> 0 = ERROR ;External data areas used EXT OCB_PTR ;POINTER TO OVERLAY CONTROL TABLE ;Global data areas defined GLOBAL D_OVERLAY_NUMBER GLOBAL D_TAPE_STATE GLOBAL D_CSA ; GLOBAL ;Local equates ; EQU ;Global equates GLOBAL READ_TAPE GLOBAL WRITE_TAPE GLOBAL KILL_TAPE READ_TAPE EQU 81H WRITE_TAPE EQU 82H KILL_TAPE EQU 87H ; INCLUDE File_name:userid PROG ; TEST FOR COMPLETION OF IO REQUEST TEST_TAPE: LD A,(D_CSA) OR A JP EXIT_TAPE ;* ;* ;* ABORT_TAPE: LD A,KILL_TAPE LD (D_CSA),A JP EXIT_TAPE ;* ;* CALC_OCB_ADDR: DEC A ;ADDR = OCB_TABLE(OV_NUM-1*5) LD C,A ;GET THE OVERLAY NUMBER IN C LD B,0 LD HL,(OCB_PTR) ;POINTER TO THE OCB TABLE ADD HL,BC ;OCB_ADDR = OVERLAY_NUM*5 + START_OF_TABLE ADD HL,BC ADD HL,BC ADD HL,BC ADD HL,BC RET ;* WRITE_OVERLAY: SCF ;SET CARRY FLAG IF WRITE INSTRUCTION! JR LD_1 ;* ;* LOAD_OVERLAY: OR A ;RESET CARRY FLAG IF READ ;* ;* LD_1: ; BEGIN (Ordinarily registers are restored; retain only the pushes and pops you need.) ;* ;* ;* LD (D_OVERLAY_NUMBER),A ;FOR DEBUGGING PURPOSES ;* ;* PUSH AF ;++++++++++++++++++++; CALL CALC_OCB_ADDR ; POP AF ;--------------------; ;SAVE THE CARRY FLAG IF SET ;* JR NC,LOAD_BLOCKS WRITE_BLOCKS: LD A,WRITE_TAPE ;WRITE INSTRUCTIONS GO HERE JR BLOCK_IO LOAD_BLOCKS: LD A,READ_TAPE ;READ INSTRUCTIONS GO HERE BLOCK_IO: LD DE,D_CSA+1 ; ;POINT TO THE COMMAND STATUS AREA LD BC,5 ; ;NUMBER OF BYTES TO MOVE LDIR LD DE,D_CSA LD (DE),A ;SET THE COMMAND IN THE D_CSA BUFFER XOR A GLOBAL EXIT_TAPE EXIT_TAPE: RET *********************************************************************************************